var dialog = '<div class="m-winwrapper" id="dialog">\
        <div class="winwrapper">\
            <div class="m-win m-win-simple">\
                <div class="winhd"><h2 class="wintt" id="dialog-title">提示</h2></div>\
                <div class="winbd" id="dialog-content">{content}</div>\
                <div class="winft">\
                    <button type="button" class="u-btn u-btn-primary u-btn-fw" data-action="confirm">确定</button>\
                    <button type="button" class="u-btn u-btn-normal u-btn-fw" data-action="cancel">取消</button>\
                </div>\
            </div>\
        </div>\
    </div>';

var loading = '<div class="v-load v-load-result" id="loading"><div class="load"><i></i><b id="loading-result"></b></div></div>';

function processBuyerIndexHtml() {
    var head_nav = $("#head_nav");
    var userName = user_Data.userName;
    var htmlTmpl = '<div class="user">买家你好，<span class="name">' + userName + '</span>!'
        + '<a href="/logout">[退出]</a></div>'
        + '<ul class="nav">'
        + '<li><a href="/">首页</a></li>'
        + '<li><a href="/account">账务</a></li>'
        + '<li><a href="/itemCart">购物车</a></li>'
        + '</ul>';
    head_nav.append(htmlTmpl);

    var tab_head = $("#tab-head");
    var tab_elem = '<li id="not-buy-li"><a id="not-buy-button">未购买的内容</a></li>';

    tab_head.append(tab_elem);
}

function processNoLoginIndexHtml() {
    var head_nav = $("#head_nav");
    var htmlTmpl = '<div class="user">请<a href="/login">[登录]</a></div>'
        + '<ul class="nav">'
        + '<li><a href="/">首页</a></li>'
        + '</ul>';
    head_nav.append(htmlTmpl);
}

function processSellerIndexHtml() {
    var head_nav = $("#head_nav");
    var userName = user_Data.userName;
    var htmlTmpl = '<div class="user">卖家你好，<span class="name">' + userName + '</span>!'
        + '<a href="/logout">[退出]</a></div>'
        + '<ul class="nav">'
        + '<li><a href="/">首页</a></li>'
        + '<li><a href="/public">发布</a></li>'
        + '</ul>';
    head_nav.append(htmlTmpl);
}

(function () {
    var userType = user_Data.loginType;
    switch (userType) {
        case 1:
            processBuyerIndexHtml();
            break;
        case 2:
            processSellerIndexHtml();
            break;
        default:
            processNoLoginIndexHtml();
            break;
    }
})();

